<!doctype html><html lang="en">
 <head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="#3c790a" name="theme-color">
  <title>Storage Standard</title>
  <link crossorigin href="https://resources.whatwg.org/spec.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/standard.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/standard-shared-with-dev.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/logo-storage.svg" rel="icon">
<script async crossorigin src="https://resources.whatwg.org/file-issue.js"></script>
<script async crossorigin src="https://resources.whatwg.org/commit-snapshot-shortcut-key.js"></script>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
 <body class="h-entry status-LS">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" crossorigin height="100" src="https://resources.whatwg.org/logo-storage.svg"> </a> </p>
   <hgroup>
    <h1 class="p-name no-ref" id="title">Storage</h1>
    <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   </hgroup>
   <div data-fill-with="spec-metadata">
    <dl>
     <dt>Participate:
     <dd><a href="https://github.com/whatwg/storage">GitHub whatwg/storage</a> (<a href="https://github.com/whatwg/storage/issues/new">new issue</a>, <a href="https://github.com/whatwg/storage/issues">open issues</a>)
     <dd><a href="https://wiki.whatwg.org/wiki/IRC">IRC: #whatwg on Freenode</a>
     <dt>Commits:
     <dd><a href="https://github.com/whatwg/storage/commits">GitHub whatwg/storage/commits</a>
     <dd>[SNAPSHOT-LINK]
     <dd><a href="https://twitter.com/storagestandard">@storagestandard</a>
     <dt>Tests:
     <dd><a href="https://github.com/web-platform-tests/wpt/tree/master/storage">web-platform-tests storage/</a> (<a href="https://github.com/web-platform-tests/wpt/labels/storage">ongoing work</a>)
     <dt>Translations <small>(non-normative)</small>:
     <dd><span title="Japanese"><a href="https://triple-underscore.github.io/storage-ja.html" hreflang="ja" lang="ja" rel="alternate">日本語</a></span>
    </dl>
   </div>
   <div data-fill-with="warning"></div>
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>The Storage Standard defines an API for persistent storage and quota estimates, as well as the platform storage architecture.</p>
  </div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li><a href="#introduction"><span class="secno">1</span> <span class="content">Introduction</span></a>
    <li><a href="#terminology"><span class="secno">2</span> <span class="content">Terminology</span></a>
    <li>
     <a href="#infrastructure"><span class="secno">3</span> <span class="content">Infrastructure</span></a>
     <ol class="toc">
      <li><a href="#buckets"><span class="secno">3.1</span> <span class="content">Buckets</span></a>
     </ol>
    <li><a href="#persistence"><span class="secno">4</span> <span class="content">Persistence permission</span></a>
    <li><a href="#usage-and-quota"><span class="secno">5</span> <span class="content">Usage and quota</span></a>
    <li>
     <a href="#ui-guidelines"><span class="secno">6</span> <span class="content">User Interface Guidelines</span></a>
     <ol class="toc">
      <li><a href="#storage-pressure"><span class="secno">6.1</span> <span class="content">Storage Pressure</span></a>
     </ol>
    <li><a href="#api"><span class="secno">7</span> <span class="content">API</span></a>
    <li><a href="#acks"><span class="secno"></span> <span class="content">Acknowledgments</span></a>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
     </ol>
    <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
   </ol>
  </nav>
  <main>
   <h2 class="heading settled" data-level="1" id="introduction"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#introduction"></a></h2>
   <p>Over the years the web has grown various APIs that can be used for storage, e.g., IndexedDB, <code>localStorage</code>, and <code>showNotification()</code>. The Storage Standard consolidates
these APIs by defining:</p>
   <ul class="brief">
    <li>A bucket, the primitive these APIs store their data in 
    <li>A way of making that bucket persistent 
    <li>A way of getting usage and quota estimates for an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin">origin</a> 
   </ul>
   <p>Traditionally, as the user runs out of storage space on their device, the data stored with these
APIs gets lost without the user being able to intervene. However, persistent buckets cannot be
cleared without consent by the user. This thus brings data guarantees users have enjoyed on native
platforms to the web. </p>
   <div class="example" id="example-3a7051a8">
    <a class="self-link" href="#example-3a7051a8"></a> 
    <p>A simple way to make storage persistent is through invoking the <code class="idl"><a data-link-type="idl" href="#dom-storagemanager-persist" id="ref-for-dom-storagemanager-persist">persist()</a></code> method. It
 simultaneously requests the end user for permission and changes the storage to be persistent once
 granted:</p>
<pre><code class="lang-javascript highlight">navigator<c- p>.</c->storage<c- p>.</c->persist<c- p>().</c->then<c- p>(</c->persisted <c- p>=></c-> <c- p>{</c->
  <c- k>if</c-><c- p>(</c->persisted<c- p>)</c-> <c- p>{</c->
    <c- d>/* … */</c->
  <c- p>}</c->
<c- p>})</c->
</code></pre>
    <p>To not show user-agent-driven dialogs to the end user unannounced slightly more involved code
 can be written:</p>
<pre><code class="lang-javascript highlight">Promise<c- p>.</c->all<c- p>([</c->
  navigator<c- p>.</c->storage<c- p>.</c->persisted<c- p>(),</c->
  navigator<c- p>.</c->permissions<c- p>.</c->query<c- p>({</c->name<c- o>:</c-> <c- u>"persistent-storage"</c-><c- p>})</c->
<c- p>]).</c->then<c- p>(([</c->persisted<c- p>,</c-> permission<c- p>])</c-> <c- p>=></c-> <c- p>{</c->
  <c- k>if</c-><c- p>(</c-><c- o>!</c->persisted <c- o>&amp;&amp;</c-> permission<c- p>.</c->status <c- o>==</c-> <c- u>"granted"</c-><c- p>)</c-> <c- p>{</c->
    navigator<c- p>.</c->storage<c- p>.</c->persist<c- p>().</c->then<c- p>(</c-> <c- d>/* … */</c-> <c- p>)</c->
  <c- p>}</c-> <c- k>else</c-> <c- k>if</c-><c- p>(</c-><c- o>!</c->persistent <c- o>&amp;&amp;</c-> permission<c- p>.</c->status <c- o>==</c-> <c- u>"prompt"</c-><c- p>)</c-> <c- p>{</c->
    showPersistentStorageExplanation<c- p>()</c->
  <c- p>}</c->
<c- p>})</c->
</code></pre>
    <p>The <code class="idl"><a data-link-type="idl" href="#dom-storagemanager-estimate" id="ref-for-dom-storagemanager-estimate">estimate()</a></code> method can be used to determine whether there is enough space left to
 store content for an application: </p>
<pre><code class="lang-javascript highlight"><c- a>function</c-> retrieveNextChunk<c- p>(</c->nextChunkInfo<c- p>)</c-> <c- p>{</c->
  <c- k>return</c-> navigator<c- p>.</c->storage<c- p>.</c->estimate<c- p>().</c->then<c- p>(</c->info <c- p>=></c-> <c- p>{</c->
    <c- k>if</c-><c- p>(</c->info<c- p>.</c->quota <c- o>-</c-> info<c- p>.</c->usage <c- o>></c-> nextChunkInfo<c- p>.</c->size<c- p>)</c->
      <c- k>return</c-> fetch<c- p>(</c->nextChunkInfo<c- p>.</c->url<c- p>)</c->
    <c- k>else</c-> <c- k>throw</c-> <c- k>new</c-> Error<c- p>(</c-><c- u>"insufficient space to store next chunk"</c-><c- p>)</c->
  <c- p>}).</c->then<c- p>(</c-> <c- d>/* … */</c-> <c- p>)</c->
<c- p>}</c->
</code></pre>
   </div>
   <h2 class="heading settled" data-level="2" id="terminology"><span class="secno">2. </span><span class="content">Terminology</span><a class="self-link" href="#terminology"></a></h2>
   <p>This specification depends on the Infra Standard. <a data-link-type="biblio" href="#biblio-infra">[INFRA]</a> </p>
   <p>This specification uses terminology from the DOM, HTML, IDL, Permissions API, and URL Standards. <a data-link-type="biblio" href="#biblio-dom">[DOM]</a> <a data-link-type="biblio" href="#biblio-html">[HTML]</a> <a data-link-type="biblio" href="#biblio-webidl">[WEBIDL]</a> <a data-link-type="biblio" href="#biblio-permissions">[PERMISSIONS]</a> <a data-link-type="biblio" href="#biblio-url">[URL]</a> </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="schemeless-origin-group">schemeless origin group</dfn> is a group of one of the following:</p>
   <ul>
    <li>Identical <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque">opaque origins</a>. 
    <li><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-tuple" id="ref-for-concept-origin-tuple">Tuple origins</a> whose <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-host" id="ref-for-concept-origin-host">host</a> is identical and not a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-domain" id="ref-for-concept-domain">domain</a>. 
    <li><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-tuple" id="ref-for-concept-origin-tuple①">Tuple origins</a> whose <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-host" id="ref-for-concept-origin-host①">host</a> is a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-domain" id="ref-for-concept-domain①">domain</a> of
 which the <a href="https://publicsuffix.org/list/">registrable domain</a> is identical.
   </ul>
   <p class="note" role="note">This definition will move to a more suitable location eventually. </p>
   <h2 class="heading settled" data-level="3" id="infrastructure"><span class="secno">3. </span><span class="content">Infrastructure</span><a class="self-link" href="#infrastructure"></a></h2>
   <p>A user agent has various kinds of storage:</p>
   <dl>
    <dt>Credentials 
    <dd>
     <p>End-user credentials, such as username and passwords submitted through HTML forms </p>
    <dt>Permissions 
    <dd>
     <p>Permissions for various features, such as geolocation </p>
    <dt>Network 
    <dd>
     <p>HTTP cache, cookies, authentication entries, TLS client certificates </p>
    <dt>Site 
    <dd>Indexed DB, Cache API, service worker registrations, <code>localStorage</code>, <code>history.pushState()</code>, application caches, notifications, etc. 
   </dl>
   <p>This specification primarily concerns itself with <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="site-storage">site storage</dfn>.</p>
   <p><a data-link-type="dfn" href="#site-storage" id="ref-for-site-storage">Site storage</a> consists of zero or more <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="site-storage-unit">site storage units</dfn>.</p>
   <p>Each <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin①">origin</a> has an associated <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit">site storage unit</a>. A <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit①">site storage unit</a> contains a single <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="bucket">bucket<span id="box"></span></dfn>. <a data-link-type="biblio" href="#biblio-html">[HTML]</a></p>
   <h3 class="heading settled" data-level="3.1" id="buckets"><span class="secno">3.1. </span><span class="content">Buckets</span><span id="boxes"></span><a class="self-link" href="#buckets"></a></h3>
   <p>A <a data-link-type="dfn" href="#bucket" id="ref-for-bucket">bucket</a> has <dfn class="dfn-paneled" data-dfn-for="bucket" data-dfn-type="dfn" data-export id="bucket-mode">mode<span id="box-mode"></span></dfn> which is either
"<code title>best-effort</code>" or "<code title>persistent</code>". A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="persistent-bucket">persistent bucket<span id="persistent-box"></span></dfn> is a <a data-link-type="dfn" href="#bucket" id="ref-for-bucket①">bucket</a> whose <a data-link-type="dfn" href="#bucket-mode" id="ref-for-bucket-mode">mode</a> is "<code title>persistent</code>". A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="non-persistent-bucket">non-persistent bucket<span id="non-persistent-box"></span></dfn> is a <a data-link-type="dfn" href="#bucket" id="ref-for-bucket②">bucket</a> whose <a data-link-type="dfn" href="#bucket-mode" id="ref-for-bucket-mode①">mode</a> is <em>not</em> "<code title>persistent</code>".</p>
   <p>A bucket is considered to be an atomic unit. Whenever a <a data-link-type="dfn" href="#bucket" id="ref-for-bucket③">bucket</a> is cleared by the user agent,
it must be cleared in its entirety.</p>
   <h2 class="heading settled" data-level="4" id="persistence"><span class="secno">4. </span><span class="content">Persistence permission</span><a class="self-link" href="#persistence"></a></h2>
   <p>A <a data-link-type="dfn" href="#bucket" id="ref-for-bucket④">bucket</a> can only be turned into a <a data-link-type="dfn" href="#persistent-bucket" id="ref-for-persistent-bucket">persistent bucket</a> if the user (or user agent
on behalf of the user) has granted permission to use the <code class="idl"><a data-link-type="idl" href="#dom-permissionname-persistent-storage" id="ref-for-dom-permissionname-persistent-storage">"persistent-storage"</a></code> feature.</p>
   <p class="note" role="note">When granted to an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin②">origin</a>, the persistence permission can be used to
protect storage from the user agent’s clearing policies. The user agent cannot clear storage marked
as persistent without involvement from the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin③">origin</a> or user. This makes it particularly
useful for resources the user needs to have available while offline or resources the user creates
locally. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="PermissionName" data-dfn-type="enum-value" data-export id="dom-permissionname-persistent-storage"><code>"<code>persistent-storage</code>"</code></dfn> <a data-link-type="dfn" href="https://w3c.github.io/permissions/#powerful-feature" id="ref-for-powerful-feature">powerful feature</a>’s permission-related flags, algorithms, and types are defaulted, except for:</p>
   <dl>
    <dt><a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-state" id="ref-for-permission-state">permission state</a>
    <dd><code class="idl"><a data-link-type="idl" href="#dom-permissionname-persistent-storage" id="ref-for-dom-permissionname-persistent-storage①">"persistent-storage"</a></code>'s <a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-state" id="ref-for-permission-state①">permission state</a> must have the same value for all <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object" id="ref-for-environment-settings-object">environment settings objects</a> with a given <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin④">origin</a>.
    <dt><a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-revocation-algorithm" id="ref-for-permission-revocation-algorithm">permission revocation algorithm</a>
    <dd class="algorithm" data-algorithm="permission-revocation">If <code class="idl"><a data-link-type="idl" href="#dom-permissionname-persistent-storage" id="ref-for-dom-permissionname-persistent-storage②">"persistent-storage"</a></code>'s <a data-link-type="dfn" href="https://w3c.github.io/permissions/#permission-state" id="ref-for-permission-state②">permission state</a> is not <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstate-granted" id="ref-for-dom-permissionstate-granted">"granted"</a></code>, then set the current <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin⑤">origin</a>’s <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit②">site storage unit</a>’s <a data-link-type="dfn" href="#bucket" id="ref-for-bucket⑤">bucket</a>’s <a data-link-type="dfn" href="#bucket-mode" id="ref-for-bucket-mode②">mode</a> to "<code>best-effort</code>".
   </dl>
   <h2 class="heading settled" data-level="5" id="usage-and-quota"><span class="secno">5. </span><span class="content">Usage and quota</span><a class="self-link" href="#usage-and-quota"></a></h2>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="site-storage-usage">site storage usage</dfn> of an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin⑥">origin</a> <var>origin</var> is a rough
estimate of the amount of bytes used in <var>origin</var>’s <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit③">site storage unit</a>.</p>
   <p class="note" role="note">This cannot be an exact amount as user agents might, and are encouraged to, use
deduplication, compression, and other techniques that obscure exactly how much bytes an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin⑦">origin</a> uses. </p>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="site-storage-quota">site storage quota</dfn> of an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin⑧">origin</a> <var>origin</var> is a
conservative estimate of the amount of bytes available to <var>origin</var>’s <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit④">site storage unit</a>. This amount should be less than the total available storage space on the
device to give users some wiggle room.</p>
   <p class="note" role="note">User agents are strongly encouraged to provide "popular" <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin⑨">origins</a> with a
larger <a data-link-type="dfn" href="#site-storage-quota" id="ref-for-site-storage-quota">site storage quota</a>. Factors such as navigation frequency, recency of visits,
bookmarking, and <a href="#persistence">permission</a> for <code class="idl"><a data-link-type="idl" href="#dom-permissionname-persistent-storage" id="ref-for-dom-permissionname-persistent-storage③">"persistent-storage"</a></code> can be used as
indications of "popularity". </p>
   <h2 class="heading settled" data-level="6" id="ui-guidelines"><span class="secno">6. </span><span class="content">User Interface Guidelines</span><a class="self-link" href="#ui-guidelines"></a></h2>
   <p>User agents should not distinguish between network storage and <a data-link-type="dfn" href="#site-storage" id="ref-for-site-storage①">site storage</a> in their user
interface. Instead user agents should offer users the ability to remove all storage for a given <a data-link-type="dfn" href="#schemeless-origin-group" id="ref-for-schemeless-origin-group">schemeless origin group</a>. This ensures to some extent that network storage cannot be used to
revive <a data-link-type="dfn" href="#site-storage" id="ref-for-site-storage②">site storage</a>. This also reduces the amount users need to know about the different ways
in which a <a data-link-type="dfn" href="#schemeless-origin-group" id="ref-for-schemeless-origin-group①">schemeless origin group</a> can store data.</p>
   <p>Credentials storage should be separated as it might contain data the user might not be able to
revive, such as an autogenerated password. Since permissions storage is mostly simple booleans it
too can be separated to avoid inconveniencing the user. Credentials and permissions are also
somewhat easier to understand and differentiate for users from network storage and <a data-link-type="dfn" href="#site-storage" id="ref-for-site-storage③">site storage</a>.</p>
   <h3 class="heading settled" data-level="6.1" id="storage-pressure"><span class="secno">6.1. </span><span class="content">Storage Pressure</span><a class="self-link" href="#storage-pressure"></a></h3>
   <p>When the user agent notices it comes under storage pressure and it cannot free up sufficient space
by clearing network storage and <a data-link-type="dfn" href="#non-persistent-bucket" id="ref-for-non-persistent-bucket">non-persistent buckets</a> within <a data-link-type="dfn" href="#site-storage" id="ref-for-site-storage④">site storage</a>, then the
user agent should alert the user and offer a way to clear <a data-link-type="dfn" href="#persistent-bucket" id="ref-for-persistent-bucket①">persistent buckets</a>.</p>
   <h2 class="heading settled" data-level="7" id="api"><span class="secno">7. </span><span class="content">API</span><a class="self-link" href="#api"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext"><c- g>SecureContext</c-></a>]
<c- b>interface</c-> <c- b>mixin</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="navigatorstorage"><code><c- g>NavigatorStorage</c-></code></dfn> {
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SameObject" id="ref-for-SameObject"><c- g>SameObject</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#storagemanager" id="ref-for-storagemanager"><c- n>StorageManager</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="StorageManager" href="#dom-navigatorstorage-storage" id="ref-for-dom-navigatorstorage-storage"><c- g>storage</c-></a>;
};
<a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/system-state.html#navigator" id="ref-for-navigator"><c- n>Navigator</c-></a> <c- b>includes</c-> <a class="n" data-link-type="idl-name" href="#navigatorstorage" id="ref-for-navigatorstorage"><c- n>NavigatorStorage</c-></a>;
<a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/workers.html#workernavigator" id="ref-for-workernavigator"><c- n>WorkerNavigator</c-></a> <c- b>includes</c-> <a class="n" data-link-type="idl-name" href="#navigatorstorage" id="ref-for-navigatorstorage①"><c- n>NavigatorStorage</c-></a>;
</pre>
   <p>Each <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object" id="ref-for-environment-settings-object①">environment settings object</a> has an associated <code class="idl"><a data-link-type="idl" href="#storagemanager" id="ref-for-storagemanager①">StorageManager</a></code> object. <a data-link-type="biblio" href="#biblio-html">[HTML]</a></p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="NavigatorStorage" data-dfn-type="attribute" data-export id="dom-navigatorstorage-storage"><code>storage</code></dfn> attribute’s getter must return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object">context object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object">relevant settings object</a>’s <code class="idl"><a data-link-type="idl" href="#storagemanager" id="ref-for-storagemanager②">StorageManager</a></code> object.</p>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext①"><c- g>SecureContext</c-></a>,
 <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="storagemanager"><code><c- g>StorageManager</c-></code></dfn> {
  <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-storagemanager-persisted" id="ref-for-dom-storagemanager-persisted"><c- g>persisted</c-></a>();
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-storagemanager-persist" id="ref-for-dom-storagemanager-persist①"><c- g>persist</c-></a>();

  <c- b>Promise</c->&lt;<a class="n" data-link-type="idl-name" href="#dictdef-storageestimate" id="ref-for-dictdef-storageestimate"><c- n>StorageEstimate</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-storagemanager-estimate" id="ref-for-dom-storagemanager-estimate①"><c- g>estimate</c-></a>();
};

<c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-storageestimate"><code><c- g>StorageEstimate</c-></code></dfn> {
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="StorageEstimate" data-dfn-type="dict-member" data-export data-type="unsigned long long " id="dom-storageestimate-usage"><code><c- g>usage</c-></code></dfn>;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long①"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="StorageEstimate" data-dfn-type="dict-member" data-export data-type="unsigned long long " id="dom-storageestimate-quota"><code><c- g>quota</c-></code></dfn>;
};
</pre>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="StorageManager" data-dfn-type="method" data-export id="dom-storagemanager-persisted"><code>persisted()</code></dfn> method, when invoked, must run
these steps:</p>
   <ol>
    <li>
     <p>Let <var>promise</var> be a new promise. </p>
    <li>
     <p>Let <var>origin</var> be <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①">context object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object①">relevant settings object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin" id="ref-for-concept-settings-object-origin">origin</a>. </p>
    <li>
     <p>If <var>origin</var> is an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque①">opaque origin</a>, then reject <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code>. </p>
    <li>
     <p>Otherwise, run these steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel">in parallel</a>: </p>
     <ol>
      <li>
       <p>Let <var>persisted</var> be true if <var>origin</var>’s <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit⑤">site storage unit</a>’s <a data-link-type="dfn" href="#bucket" id="ref-for-bucket⑥">bucket</a> is a <a data-link-type="dfn" href="#persistent-bucket" id="ref-for-persistent-bucket②">persistent bucket</a>, and false otherwise. </p>
       <p class="note" role="note">It will be false when there’s an internal error. </p>
      <li>
       <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task">Queue a task</a> to resolve <var>promise</var> with <var>persisted</var>. </p>
     </ol>
    <li>
     <p>Return <var>promise</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="StorageManager" data-dfn-type="method" data-export id="dom-storagemanager-persist"><code>persist()</code></dfn> method, when invoked, must run these
steps:</p>
   <ol>
    <li>
     <p>Let <var>promise</var> be a new promise. </p>
    <li>
     <p>Let <var>origin</var> be <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②">context object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object②">relevant settings object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin" id="ref-for-concept-settings-object-origin①">origin</a>. </p>
    <li>
     <p>If <var>origin</var> is an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque②">opaque origin</a>, then reject <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror①">TypeError</a></code>. </p>
    <li>
     <p>Otherwise, run these steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel①">in parallel</a>: </p>
     <ol>
      <li>
       <p>Let <var>permission</var> be the result of <a data-link-type="dfn" href="https://w3c.github.io/permissions/#request-permission-to-use" id="ref-for-request-permission-to-use">requesting permission to use</a> <code class="idl"><a data-link-type="idl" href="#dom-permissionname-persistent-storage" id="ref-for-dom-permissionname-persistent-storage④">"persistent-storage"</a></code>. </p>
       <p class="note" role="note">User agents are encouraged to not let the user answer this question twice for
    the same <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin①⓪">origin</a> around the same time and this algorithm is not equipped to handle
    such a scenario. </p>
      <li>
       <p>Let <var>persisted</var> be true, if <var>origin</var>’s <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit⑥">site storage unit</a>’s <a data-link-type="dfn" href="#bucket" id="ref-for-bucket⑦">bucket</a> is a <a data-link-type="dfn" href="#persistent-bucket" id="ref-for-persistent-bucket③">persistent bucket</a>, and false otherwise. </p>
       <p class="note" role="note">It will be false when there’s an internal error. </p>
      <li>
       <p>If <var>persisted</var> is false and <var>permission</var> is <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/permissions/#dom-permissionstate-granted" id="ref-for-dom-permissionstate-granted①">"granted"</a></code>, then: </p>
       <ol>
        <li>
         <p>Set <var>origin</var>’s <a data-link-type="dfn" href="#site-storage-unit" id="ref-for-site-storage-unit⑦">site storage unit</a>’s <a data-link-type="dfn" href="#bucket" id="ref-for-bucket⑧">bucket</a>’s <a data-link-type="dfn" href="#bucket-mode" id="ref-for-bucket-mode③">mode</a> to
     "<code>persistent</code>". </p>
        <li>
         <p>If there was no internal error, then set <var>persisted</var> to true. </p>
       </ol>
      <li>
       <p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task①">Queue a task</a> to resolve <var>promise</var> with <var>persisted</var>. </p>
     </ol>
    <li>
     <p>Return <var>promise</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="StorageManager" data-dfn-type="method" data-export id="dom-storagemanager-estimate"><code>estimate()</code></dfn> method, when invoked,
must run these steps:</p>
   <ol>
    <li>
     <p>Let <var>promise</var> be a new promise. </p>
    <li>
     <p>Let <var>origin</var> be <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③">context object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object" id="ref-for-relevant-settings-object③">relevant settings object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin" id="ref-for-concept-settings-object-origin②">origin</a>. </p>
    <li>
     <p>If <var>origin</var> is an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque③">opaque origin</a>, then reject <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror②">TypeError</a></code>. </p>
    <li>
     <p>Otherwise, run these steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel②">in parallel</a>: </p>
     <ol>
      <li>
       <p>Let <var>usage</var> be <a data-link-type="dfn" href="#site-storage-usage" id="ref-for-site-storage-usage">site storage usage</a> for <var>origin</var>. </p>
      <li>
       <p>Let <var>quota</var> be <a data-link-type="dfn" href="#site-storage-quota" id="ref-for-site-storage-quota①">site storage quota</a> for <var>origin</var>. </p>
      <li>
       <p>Let <var>dictionary</var> be a new <code class="idl"><a data-link-type="idl" href="#dictdef-storageestimate" id="ref-for-dictdef-storageestimate①">StorageEstimate</a></code> dictionary whose <code class="idl"><a data-link-type="idl" href="#dom-storageestimate-usage" id="ref-for-dom-storageestimate-usage">usage</a></code> member
   is <var>usage</var> and <code class="idl"><a data-link-type="idl" href="#dom-storageestimate-quota" id="ref-for-dom-storageestimate-quota">quota</a></code> member is <var>quota</var>. </p>
      <li>
       <p>If there was an internal error while obtaining <var>usage</var> and <var>quota</var>, then <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task②">queue a task</a> to reject <var>promise</var> with a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror③">TypeError</a></code>. </p>
       <p class="note" role="note">Internal errors are supposed to be extremely rare and indicate some kind of
    low-level platform or hardware fault. However, at the scale of the web with the diversity of
    implementation and platforms, the unexpected does occur. </p>
      <li>
       <p>Otherwise, <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" id="ref-for-queue-a-task③">queue a task</a> to resolve <var>promise</var> with <var>dictionary</var>. </p>
     </ol>
    <li>
     <p>Return <var>promise</var>. </p>
   </ol>
   <h2 class="no-num heading settled" id="acks"><span class="content">Acknowledgments</span><a class="self-link" href="#acks"></a></h2>
   <p>With that, many thanks to
Adrian Bateman,
Alex Russell,
Aislinn Grigas,
Ali Alabbas,
Ben Kelly,
Ben Turner,
Dale Harvey,
David Grogan,
fantasai,
Jake Archibald,
Jeffrey Yasskin,
Jinho Bang,
Jonas Sicking,
Joshua Bell,
Kenji Baheux,
Kinuko Yasuda,
Luke Wagner,
Michael Nordman,
Mounir Lamouri,
Shachar Zohar,
黃強 (Shawn Huang), and
簡冠庭 (Timothy Guan-tin Chien)
for being awesome!</p>
   <p>This standard is written by <a href="https://annevankesteren.nl/" lang="nl">Anne van Kesteren</a> (<a href="https://www.mozilla.org/">Mozilla</a>, <a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>).</p>
   <p>Copyright © 1970 WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution
4.0 International License</a>. </p>
  </main>
<script>
"use strict";
if ("serviceWorker" in navigator) {
  navigator.serviceWorker.register("/service-worker.js");
}
</script>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li><a href="#bucket">bucket</a><span>, in §3</span>
   <li><a href="#dom-storagemanager-estimate">estimate()</a><span>, in §7</span>
   <li><a href="#bucket-mode">mode</a><span>, in §3.1</span>
   <li><a href="#navigatorstorage">NavigatorStorage</a><span>, in §7</span>
   <li><a href="#non-persistent-bucket">non-persistent bucket</a><span>, in §3.1</span>
   <li><a href="#dom-storagemanager-persist">persist()</a><span>, in §7</span>
   <li><a href="#dom-storagemanager-persisted">persisted()</a><span>, in §7</span>
   <li><a href="#persistent-bucket">persistent bucket</a><span>, in §3.1</span>
   <li><a href="#dom-permissionname-persistent-storage">"persistent-storage"</a><span>, in §4</span>
   <li><a href="#dom-storageestimate-quota">quota</a><span>, in §7</span>
   <li><a href="#schemeless-origin-group">schemeless origin group</a><span>, in §2</span>
   <li><a href="#site-storage">site storage</a><span>, in §3</span>
   <li><a href="#site-storage-quota">site storage quota</a><span>, in §5</span>
   <li><a href="#site-storage-unit">site storage units</a><span>, in §3</span>
   <li><a href="#site-storage-usage">site storage usage</a><span>, in §5</span>
   <li><a href="#dom-navigatorstorage-storage">storage</a><span>, in §7</span>
   <li><a href="#dictdef-storageestimate">StorageEstimate</a><span>, in §7</span>
   <li><a href="#storagemanager">StorageManager</a><span>, in §7</span>
   <li><a href="#dom-storageestimate-usage">usage</a><span>, in §7</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-context-object">
   <a href="https://dom.spec.whatwg.org/#context-object">https://dom.spec.whatwg.org/#context-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-context-object">7. API</a> <a href="#ref-for-context-object①">(2)</a> <a href="#ref-for-context-object②">(3)</a> <a href="#ref-for-context-object③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-navigator">
   <a href="https://html.spec.whatwg.org/multipage/system-state.html#navigator">https://html.spec.whatwg.org/multipage/system-state.html#navigator</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-navigator">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-workernavigator">
   <a href="https://html.spec.whatwg.org/multipage/workers.html#workernavigator">https://html.spec.whatwg.org/multipage/workers.html#workernavigator</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-workernavigator">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-environment-settings-object">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object">https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-environment-settings-object">4. Persistence permission</a>
    <li><a href="#ref-for-environment-settings-object①">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-origin-host">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-host">https://html.spec.whatwg.org/multipage/origin.html#concept-origin-host</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-origin-host">2. Terminology</a> <a href="#ref-for-concept-origin-host①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-in-parallel">
   <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-in-parallel">7. API</a> <a href="#ref-for-in-parallel①">(2)</a> <a href="#ref-for-in-parallel②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-origin-opaque">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque">https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-origin-opaque">2. Terminology</a>
    <li><a href="#ref-for-concept-origin-opaque①">7. API</a> <a href="#ref-for-concept-origin-opaque②">(2)</a> <a href="#ref-for-concept-origin-opaque③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-settings-object-origin">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin">https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-settings-object-origin">7. API</a> <a href="#ref-for-concept-settings-object-origin①">(2)</a> <a href="#ref-for-concept-settings-object-origin②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-queue-a-task">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-queue-a-task">7. API</a> <a href="#ref-for-queue-a-task①">(2)</a> <a href="#ref-for-queue-a-task②">(3)</a> <a href="#ref-for-queue-a-task③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-relevant-settings-object">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object">https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relevant-settings-object">7. API</a> <a href="#ref-for-relevant-settings-object①">(2)</a> <a href="#ref-for-relevant-settings-object②">(3)</a> <a href="#ref-for-relevant-settings-object③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-origin-tuple">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-tuple">https://html.spec.whatwg.org/multipage/origin.html#concept-origin-tuple</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-origin-tuple">2. Terminology</a> <a href="#ref-for-concept-origin-tuple①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-permissionstate-granted">
   <a href="https://w3c.github.io/permissions/#dom-permissionstate-granted">https://w3c.github.io/permissions/#dom-permissionstate-granted</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionstate-granted">4. Persistence permission</a>
    <li><a href="#ref-for-dom-permissionstate-granted①">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-revocation-algorithm">
   <a href="https://w3c.github.io/permissions/#permission-revocation-algorithm">https://w3c.github.io/permissions/#permission-revocation-algorithm</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-revocation-algorithm">4. Persistence permission</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-permission-state">
   <a href="https://w3c.github.io/permissions/#permission-state">https://w3c.github.io/permissions/#permission-state</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-permission-state">4. Persistence permission</a> <a href="#ref-for-permission-state①">(2)</a> <a href="#ref-for-permission-state②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-powerful-feature">
   <a href="https://w3c.github.io/permissions/#powerful-feature">https://w3c.github.io/permissions/#powerful-feature</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-powerful-feature">4. Persistence permission</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-request-permission-to-use">
   <a href="https://w3c.github.io/permissions/#request-permission-to-use">https://w3c.github.io/permissions/#request-permission-to-use</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-request-permission-to-use">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-domain">
   <a href="https://url.spec.whatwg.org/#concept-domain">https://url.spec.whatwg.org/#concept-domain</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-domain">2. Terminology</a> <a href="#ref-for-concept-domain①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-Exposed">
   <a href="https://heycam.github.io/webidl/#Exposed">https://heycam.github.io/webidl/#Exposed</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-Exposed">7. API</a> <a href="#ref-for-Exposed①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-SameObject">
   <a href="https://heycam.github.io/webidl/#SameObject">https://heycam.github.io/webidl/#SameObject</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-SameObject">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-SecureContext">
   <a href="https://heycam.github.io/webidl/#SecureContext">https://heycam.github.io/webidl/#SecureContext</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-SecureContext">7. API</a> <a href="#ref-for-SecureContext①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-exceptiondef-typeerror">
   <a href="https://heycam.github.io/webidl/#exceptiondef-typeerror">https://heycam.github.io/webidl/#exceptiondef-typeerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-exceptiondef-typeerror">7. API</a> <a href="#ref-for-exceptiondef-typeerror①">(2)</a> <a href="#ref-for-exceptiondef-typeerror②">(3)</a> <a href="#ref-for-exceptiondef-typeerror③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-boolean">
   <a href="https://heycam.github.io/webidl/#idl-boolean">https://heycam.github.io/webidl/#idl-boolean</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-boolean">7. API</a> <a href="#ref-for-idl-boolean①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-unsigned-long-long">
   <a href="https://heycam.github.io/webidl/#idl-unsigned-long-long">https://heycam.github.io/webidl/#idl-unsigned-long-long</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-unsigned-long-long">7. API</a> <a href="#ref-for-idl-unsigned-long-long①">(2)</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[DOM]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-context-object" style="color:initial">context object</span>
    </ul>
   <li>
    <a data-link-type="biblio">[HTML]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-navigator" style="color:initial">Navigator</span>
     <li><span class="dfn-paneled" id="term-for-workernavigator" style="color:initial">WorkerNavigator</span>
     <li><span class="dfn-paneled" id="term-for-environment-settings-object" style="color:initial">environment settings object</span>
     <li><span class="dfn-paneled" id="term-for-concept-origin-host" style="color:initial">host</span>
     <li><span class="dfn-paneled" id="term-for-in-parallel" style="color:initial">in parallel</span>
     <li><span class="dfn-paneled" id="term-for-concept-origin-opaque" style="color:initial">opaque origin</span>
     <li><span class="dfn-paneled" id="term-for-concept-settings-object-origin" style="color:initial">origin <small>(for environment settings object)</small></span>
     <li><span class="dfn-paneled" id="term-for-queue-a-task" style="color:initial">queue a task</span>
     <li><span class="dfn-paneled" id="term-for-relevant-settings-object" style="color:initial">relevant settings object</span>
     <li><span class="dfn-paneled" id="term-for-concept-origin-tuple" style="color:initial">tuple origin</span>
    </ul>
   <li>
    <a data-link-type="biblio">[PERMISSIONS]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-dom-permissionstate-granted" style="color:initial">"granted"</span>
     <li><span class="dfn-paneled" id="term-for-permission-revocation-algorithm" style="color:initial">permission revocation algorithm</span>
     <li><span class="dfn-paneled" id="term-for-permission-state" style="color:initial">permission state</span>
     <li><span class="dfn-paneled" id="term-for-powerful-feature" style="color:initial">powerful feature</span>
     <li><span class="dfn-paneled" id="term-for-request-permission-to-use" style="color:initial">requesting permission to use</span>
    </ul>
   <li>
    <a data-link-type="biblio">[URL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-concept-domain" style="color:initial">domain</span>
    </ul>
   <li>
    <a data-link-type="biblio">[WEBIDL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-Exposed" style="color:initial">Exposed</span>
     <li><span class="dfn-paneled" id="term-for-SameObject" style="color:initial">SameObject</span>
     <li><span class="dfn-paneled" id="term-for-SecureContext" style="color:initial">SecureContext</span>
     <li><span class="dfn-paneled" id="term-for-exceptiondef-typeerror" style="color:initial">TypeError</span>
     <li><span class="dfn-paneled" id="term-for-idl-boolean" style="color:initial">boolean</span>
     <li><span class="dfn-paneled" id="term-for-idl-unsigned-long-long" style="color:initial">unsigned long long</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-dom">[DOM]
   <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
   <dt id="biblio-html">[HTML]
   <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
   <dt id="biblio-infra">[INFRA]
   <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/">Infra Standard</a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a>
   <dt id="biblio-permissions">[PERMISSIONS]
   <dd>Mounir Lamouri; Marcos Caceres; Jeffrey Yasskin. <a href="https://w3c.github.io/permissions/">Permissions</a>. URL: <a href="https://w3c.github.io/permissions/">https://w3c.github.io/permissions/</a>
   <dt id="biblio-url">[URL]
   <dd>Anne van Kesteren. <a href="https://url.spec.whatwg.org/">URL Standard</a>. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a>
   <dt id="biblio-webidl">[WEBIDL]
   <dd>Boris Zbarsky. <a href="https://heycam.github.io/webidl/">Web IDL</a>. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext②"><c- g>SecureContext</c-></a>]
<c- b>interface</c-> <c- b>mixin</c-> <a href="#navigatorstorage"><code><c- g>NavigatorStorage</c-></code></a> {
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SameObject" id="ref-for-SameObject①"><c- g>SameObject</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#storagemanager" id="ref-for-storagemanager③"><c- n>StorageManager</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="StorageManager" href="#dom-navigatorstorage-storage" id="ref-for-dom-navigatorstorage-storage①"><c- g>storage</c-></a>;
};
<a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/system-state.html#navigator" id="ref-for-navigator①"><c- n>Navigator</c-></a> <c- b>includes</c-> <a class="n" data-link-type="idl-name" href="#navigatorstorage" id="ref-for-navigatorstorage②"><c- n>NavigatorStorage</c-></a>;
<a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/workers.html#workernavigator" id="ref-for-workernavigator①"><c- n>WorkerNavigator</c-></a> <c- b>includes</c-> <a class="n" data-link-type="idl-name" href="#navigatorstorage" id="ref-for-navigatorstorage①①"><c- n>NavigatorStorage</c-></a>;

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SecureContext" id="ref-for-SecureContext①①"><c- g>SecureContext</c-></a>,
 <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed②"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->)]
<c- b>interface</c-> <a href="#storagemanager"><code><c- g>StorageManager</c-></code></a> {
  <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean②"><c- b>boolean</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-storagemanager-persisted" id="ref-for-dom-storagemanager-persisted①"><c- g>persisted</c-></a>();
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①①"><c- g>Exposed</c-></a>=<c- n>Window</c->] <c- b>Promise</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean①①"><c- b>boolean</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-storagemanager-persist" id="ref-for-dom-storagemanager-persist①①"><c- g>persist</c-></a>();

  <c- b>Promise</c->&lt;<a class="n" data-link-type="idl-name" href="#dictdef-storageestimate" id="ref-for-dictdef-storageestimate②"><c- n>StorageEstimate</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-storagemanager-estimate" id="ref-for-dom-storagemanager-estimate①①"><c- g>estimate</c-></a>();
};

<c- b>dictionary</c-> <a href="#dictdef-storageestimate"><code><c- g>StorageEstimate</c-></code></a> {
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long②"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a data-type="unsigned long long " href="#dom-storageestimate-usage"><code><c- g>usage</c-></code></a>;
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long①①"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a data-type="unsigned long long " href="#dom-storageestimate-quota"><code><c- g>quota</c-></code></a>;
};

</pre>
  <aside class="dfn-panel" data-for="schemeless-origin-group">
   <b><a href="#schemeless-origin-group">#schemeless-origin-group</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-schemeless-origin-group">6. User Interface Guidelines</a> <a href="#ref-for-schemeless-origin-group①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="site-storage">
   <b><a href="#site-storage">#site-storage</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-site-storage">3. Infrastructure</a>
    <li><a href="#ref-for-site-storage①">6. User Interface Guidelines</a> <a href="#ref-for-site-storage②">(2)</a> <a href="#ref-for-site-storage③">(3)</a>
    <li><a href="#ref-for-site-storage④">6.1. Storage Pressure</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="site-storage-unit">
   <b><a href="#site-storage-unit">#site-storage-unit</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-site-storage-unit">3. Infrastructure</a> <a href="#ref-for-site-storage-unit①">(2)</a>
    <li><a href="#ref-for-site-storage-unit②">4. Persistence permission</a>
    <li><a href="#ref-for-site-storage-unit③">5. Usage and quota</a> <a href="#ref-for-site-storage-unit④">(2)</a>
    <li><a href="#ref-for-site-storage-unit⑤">7. API</a> <a href="#ref-for-site-storage-unit⑥">(2)</a> <a href="#ref-for-site-storage-unit⑦">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bucket">
   <b><a href="#bucket">#bucket</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bucket">3.1. Buckets</a> <a href="#ref-for-bucket①">(2)</a> <a href="#ref-for-bucket②">(3)</a> <a href="#ref-for-bucket③">(4)</a>
    <li><a href="#ref-for-bucket④">4. Persistence permission</a> <a href="#ref-for-bucket⑤">(2)</a>
    <li><a href="#ref-for-bucket⑥">7. API</a> <a href="#ref-for-bucket⑦">(2)</a> <a href="#ref-for-bucket⑧">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="bucket-mode">
   <b><a href="#bucket-mode">#bucket-mode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-bucket-mode">3.1. Buckets</a> <a href="#ref-for-bucket-mode①">(2)</a>
    <li><a href="#ref-for-bucket-mode②">4. Persistence permission</a>
    <li><a href="#ref-for-bucket-mode③">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="persistent-bucket">
   <b><a href="#persistent-bucket">#persistent-bucket</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-persistent-bucket">4. Persistence permission</a>
    <li><a href="#ref-for-persistent-bucket①">6.1. Storage Pressure</a>
    <li><a href="#ref-for-persistent-bucket②">7. API</a> <a href="#ref-for-persistent-bucket③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="non-persistent-bucket">
   <b><a href="#non-persistent-bucket">#non-persistent-bucket</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-non-persistent-bucket">6.1. Storage Pressure</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-permissionname-persistent-storage">
   <b><a href="#dom-permissionname-persistent-storage">#dom-permissionname-persistent-storage</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-permissionname-persistent-storage">4. Persistence permission</a> <a href="#ref-for-dom-permissionname-persistent-storage①">(2)</a> <a href="#ref-for-dom-permissionname-persistent-storage②">(3)</a>
    <li><a href="#ref-for-dom-permissionname-persistent-storage③">5. Usage and quota</a>
    <li><a href="#ref-for-dom-permissionname-persistent-storage④">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="site-storage-usage">
   <b><a href="#site-storage-usage">#site-storage-usage</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-site-storage-usage">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="site-storage-quota">
   <b><a href="#site-storage-quota">#site-storage-quota</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-site-storage-quota">5. Usage and quota</a>
    <li><a href="#ref-for-site-storage-quota①">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="navigatorstorage">
   <b><a href="#navigatorstorage">#navigatorstorage</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-navigatorstorage">7. API</a> <a href="#ref-for-navigatorstorage①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-navigatorstorage-storage">
   <b><a href="#dom-navigatorstorage-storage">#dom-navigatorstorage-storage</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-navigatorstorage-storage">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="storagemanager">
   <b><a href="#storagemanager">#storagemanager</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-storagemanager">7. API</a> <a href="#ref-for-storagemanager①">(2)</a> <a href="#ref-for-storagemanager②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dictdef-storageestimate">
   <b><a href="#dictdef-storageestimate">#dictdef-storageestimate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dictdef-storageestimate">7. API</a> <a href="#ref-for-dictdef-storageestimate①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-storageestimate-usage">
   <b><a href="#dom-storageestimate-usage">#dom-storageestimate-usage</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-storageestimate-usage">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-storageestimate-quota">
   <b><a href="#dom-storageestimate-quota">#dom-storageestimate-quota</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-storageestimate-quota">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-storagemanager-persisted">
   <b><a href="#dom-storagemanager-persisted">#dom-storagemanager-persisted</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-storagemanager-persisted">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-storagemanager-persist">
   <b><a href="#dom-storagemanager-persist">#dom-storagemanager-persist</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-storagemanager-persist">1. Introduction</a>
    <li><a href="#ref-for-dom-storagemanager-persist①">7. API</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-storagemanager-estimate">
   <b><a href="#dom-storagemanager-estimate">#dom-storagemanager-estimate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-storagemanager-estimate">1. Introduction</a>
    <li><a href="#ref-for-dom-storagemanager-estimate①">7. API</a>
   </ul>
  </aside>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>